<template>
  <transition name="bounce" mode="out-in">
    <div class="mui-content pd">
      <mh-header headName="发布" :showSend="showSend" @sendDynamic="sendDynamic"> </mh-header>
      <div>
        <textarea class="mui-input-clear question" cols="30" rows="15" placeholder="说点什么吧..." v-model='detail'></textarea>
      </div>
      <mh-upload></mh-upload>
    </div>
  </transition>
</template>

<script>
  import MhHeader from '@/components/mh-header/mh-header'
  import {MH_API} from "@/api/api";
  import MhUpload from '@/components/mh-upload/mh-upload';
  export default {
    name: "explore-release-dynamic",
    data () {
      return {
        showSend: true,
        detail: '',
        images: ''
      }
    },
    methods: {
      getImages(image){
        console.log(image)
        this.images = image;
      },
      sendDynamic () {
        let self = this;
        let params = {
          content: self.detail,
          images: self.images
        };
        MH_API.sendTwitter(params).then(res => {
          if (res.status === 200) {
            mui.toast('发布成功');
            setTimeout(function(){
              self.$router.go(-1)
            }, 1500)
          }
          else{
            mui.toast(res.msg);
          }
        })
      }
    },
    components: {
      MhHeader,
      MhUpload
    }
  }
</script>

<style scoped>
  .question {
    height: 8rem;
    padding: 1rem;
  }
</style>
